package cz.muni.fi.pa165.travelagency.data.dao;

import cz.muni.fi.pa165.travelagency.data.entity.Customer;
import cz.muni.fi.pa165.travelagency.data.entity.VacationOrder;
import java.util.List;

/**
 * Represents Data Access Object for Vacation Order entity class. Consists of 
 * basic CRUD operations and methods for advanced entry retrieval.
 *
 * @author Sebastian Kunec
 */
public interface VacationOrderDAO {
    
    /**
     * Creates new vacation order entity and persists it to database with 
     * autogenerated primary key.
     * 
     * @param order Vacation order to be created.
     * @throws IllegalArgumentException If vacation is null, invalid or if it 
     * already has set id.
     */
    public void create(VacationOrder order);
    
    /**
     * Retrieves vacation order from database by its primary key.
     * 
     * @param id Primary key of the vacation order entity to be retrieved.
     * @return Vacation order with provided id or null if there is no such entity.
     * @throws IllegalArgumentException If provided id is null.
     */
    public VacationOrder get(Long id);
    
    /**
     * Updates existing vacation order entity in database.
     * 
     * @param order Vacation order entity to be updated.
     * @throws IllegalArgumentException If provided vacation order entity is null, 
     * invalid or if it is not already persisted in database.
     */
    public void update(VacationOrder order);
    
    /**
     * Removes existing vacation order entity from database.
     * 
     * @param order Vacation entity to be removed.
     * @throws IllegalArgumentException If provided vacation order entity is null, 
     * invalid or if it is not already persisted in database.
     */
    public void delete(VacationOrder order);
    
    /**
     * Retrieves all persisted vacation order entities from database.
     * 
     * @return List of all persisted vacation order entities from database.
     */
    public List<VacationOrder> getAll();
    
    /**
     * Retrieves all persisted vacation order entities from database by customer.
     * 
     * @return List of all persisted vacation order entities by customer from database.
     */
    public List<VacationOrder> getOrdersByCustomer(Customer customer);
    
}
